import socket

# 这里会直接关闭你的socket
socket_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket_server.bind(('127.0.0.1', 9999))
# 允许的客户端数量
socket_server.listen(3)
conn, addr = socket_server.accept()
print('已经连接...', addr)
while True:
    recv_content = conn.recv(1024).decode('utf-8')
    if recv_content == 'quit':
        break
    conn.send(recv_content.encode('utf-8'))
    print(str(recv_content.encode('utf-8'), encoding='utf-8'))


socket_server.close()
